/*
 * FastBackupApp.java
 */
package brigal.fastbackup.gui;

import brigal.fastbackup.data.Profile;
import brigal.xml.XMLTools;
import java.io.File;
import java.util.Locale;
import org.jdesktop.application.Application;
import org.jdesktop.application.SingleFrameApplication;

/**
 * The main class of the application.
 */
public class FastBackupApp extends SingleFrameApplication {

    /**
     * At startup create and show the main frame of the application.
     */
    @Override
    protected void startup() {
        show(new FastBackupView(this));
    }

    /**
     * This method is to initialize the specified window by injecting resources.
     * Windows shown in our application come fully initialized from the GUI
     * builder, so this additional configuration is not needed.
     */
    @Override
    protected void configureWindow(java.awt.Window root) {
    }

    /**
     * A convenient static getter for the application instance.
     * @return the instance of FastBackupApp
     */
    public static FastBackupApp getApplication() {
        return Application.getInstance(FastBackupApp.class);
    }

    /**
     * Main method launching the application.
     */
    public static void main(String[] args) {
        //TODO manage logging function
        // forward logged messages to file

        //TODO used to test French localization
        Locale.setDefault(new Locale("fr", "FR"));

        readConfigurationFile();

        launch(FastBackupApp.class, args);
    //TODO standby mode waiting for folder
    //TODO scheduler mode
    //TODO profile loading in advance
    //TODO backup process
    }

    private static void readConfigurationFile() {
//        File userDirectory = findUserDirectory;
//        if (userDirectory==null) {
//            createUserDirectory();
//        }
        //TODO read config file
    }

    private static File findUserDirectory() {
        //TODO get user home directory
        //System.out.println("home directory: " + System.getProperty("user.home"));
        return null;
    }
}
